public class Sort {
    public void insert_sort(int[] nums) {
        int n = nums.length;
        for(int i = 1; i < n; i++) {
            int tmp = nums[i];
            int j = i-1;
            for(; j > 0; j--) {
                if(nums[j] > tmp) {
                    nums[j+1] = nums[j];
                }else {
                    break;
                }
            }
            //j到达-1位置
            nums[j+1] = tmp;
        }
    }
}
